from django.http import HttpResponse
import qrcode
from cStringIO import StringIO

def url_qrcode(request):
    image=qrcode.make(request.get_full_path())

    buf = StringIO()
    image.save(buf)
    image_stream = buf.getvalue()
    response = HttpResponse(image_stream, content_type="image/png")
    response['Last-Modified'] = 'Mon, 27 Apr 2015 02:05:03 GMT'
    response['Cache-Control'] = 'max-age=31536000'
    return response
